<?php  
/*
# ------------------------------------------------------------------------
# JA Job Board Package
# ------------------------------------------------------------------------
# Copyright (C) 2004-2010 JoomlArt.com. All Rights Reserved.
# @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
# Author: JoomlArt.com
# Websites: http://www.joomlart.com - http://www.joomlancers.com.
# ------------------------------------------------------------------------
*/


defined('_JEXEC') or die('Retricted Access');
global $jbconfig, $option;
$Itemid	= JRequest::getVar('Itemid', 0);
?>
<script language="javascript" type="text/javascript">
function updateCoupon(){
    var form = document.adminForm;
    
    if( form.coupon_code.value == "" ){
        alert("<?php echo JText::_("Coupon code is required");?>");
        return false;
    }
    form.task.value = "";    
    
    form.submit();
}
</script>
<div id="jobboard-content">
<div class="moduletable clearfix">
	<h3>
		<span><?php echo JText::_("Order confirmation");?></span>
	</h3>
	<form name="adminForm" action="<?php echo JURI::root();?>index.php" method="GET">
		<strong><?php echo $this->item->title; ?></strong>					

		<table class="tabledata posting-plan-confirm">
	    	<tr class="first">
	    		<td class="key" width="25%">
					<?php echo JText::_( 'Order Description' ); ?>:
				</td>				
				<td>
					<strong><?php echo $this->item->title; ?></strong>
				</td>
	    	</tr>	
	    
	    	<tr>
	    		<td class="key">
					<?php echo JText::_( 'Postings amount' ); ?>:
				</td>
				
				<td>
					<strong><?php echo $this->item->value; ?></strong>
				</td>				
	    	</tr>
	    		         	
	    	<tr>
	    		<td class="key">
					<?php echo JText::_( 'Price' ); ?>:
				</td>
				<td>
					<strong><?php echo $this->item->price; ?></strong>
					(<?php 
						if($jbconfig['currency']->get('mode', 'real_currency')=='real_currency'){
							echo $jbconfig['currency']->get('currency', '$');
					
						}
						else {
							echo $jbconfig['currency']->get('currency_symbol', 'Credit');
						}
					?>)
				</td>
	    	</tr>
	    	
	    	<?php
	    		// Check TAX
	    		if( $this->tax ){
	    			$this->item->price = $this->tax->price;
	    			?>
	    			<tr>
			    		<td class="key">
							<?php echo JText::_( 'TAX Rate' ); ?>:
						</td>
						<td>
							<?php echo $this->tax->tax_rate; ?>%
						</td>
			    	</tr>
			    	<tr>
			    		<td class="key">
							<?php echo JText::_( 'Price after TAX' ); ?>:
						</td>
						<td>
							<strong><?php echo $this->tax->price; ?></strong>
							(<?php echo $jbconfig['currency']->get('currency', '$');?>)
						</td>
			    	</tr>
	    			<?php
	    		}
	    	?>
	    	
	    	<?php if( isset($this->discountInfo) ){ 
		    	    // Show discount number in Credit confirm Form
		    	    $discountInfo = $this->discountInfo;
		    	?>
		    	<tr>
		    		<td class="key">
						<?php echo JText::_( 'Discount amount' ); ?>:
					</td>
					<td>
						<strong><?php echo $discountInfo->discount_amount; ?></strong>
						(<?php 
    						if($jbconfig['currency']->get('mode', 'real_currency')=='real_currency'){
    							echo $jbconfig['currency']->get('currency', '$');
    					
    						}
    						else {
    							echo $jbconfig['currency']->get('currency_symbol', 'Credit');
    						}
    					?>)
					</td>
		    	</tr>
		    	<tr>
		    		<td class="key">
						<?php echo JText::_( 'Total Price after Discount' ); ?>:
					</td>
					<td>
						<strong><?php echo ( $this->item->price - $discountInfo->discount_amount ); ?></strong>
						(<?php 
    						if($jbconfig['currency']->get('mode', 'real_currency')=='real_currency'){
    							echo $jbconfig['currency']->get('currency', '$');
    						}
    						else {
    							echo $jbconfig['currency']->get('currency_symbol', 'Credit');
    						}
    					?>)
					</td>
					<input type="hidden" name="coupon_id" value="<?php echo $discountInfo->id;?>" />
		    	</tr>
		    	<?php } ?>
	    	
	    	<tr>
	            <td class="key"><?php echo JText::_("Product Type"); ?>:</td>
	            <td>
	               <strong><?php echo $this->types[$this->item->type]; ?></strong>
	            </td>
	        </tr>  
	        <?php if($jbconfig['currency']->get('mode', 'real_currency')=='real_currency'){?>
	        <tr>
				<td width="28%"><?php echo JText::_("Payment Method");?>: </td>
				<td width="72%"><?php echo $this->paysys;?></td>
		  	</tr>	  	
		  	<?php }	?>
		  	
		  	<tr>
	    		<td class="key">
					<?php echo JText::_( 'Coupon code' ); ?>:
				</td>
				<td>
					<input type="text" name="coupon_code" size="20" value="<?php echo JRequest::getVar('coupon_code', ''); ?>">
					<input type="button" class="button" name="coupon" value="<?php echo JText::_('Update'); ?>" onclick="return updateCoupon();" />
				</td>
	    	</tr>	  	
		  			  		
		  	<tr><td colspan="2">&nbsp;</td></tr>
	        <tr class="last">
	            <td class="key">&nbsp;</td>
	            <td>
	            	
	               <?php 
						if($jbconfig['currency']->get('mode', 'real_currency')=='real_currency'){?>
							<input type="submit" class="button" name="Submit" value="<?php echo JText::_("CheckOut"); ?>" />
						<?php }
						else {?>
							
							<input type="submit" class="button" name="Submit" value="<?php echo JText::_("OK. Pay now"); ?>" />
						<?php }?>
					<input type="button" class="button" name="cancel" value="<?php echo JText::_('Cancel'); ?>" onclick="document.location.href='<?php echo JRoute::_("index.php?option=com_jajobboard&view=japosts&layout=selectplan");?>';" />
	            </td>
	        </tr>  
		</table>
					
					
		<?php if($jbconfig['currency']->get('mode', 'real_currency')=='real_currency'){?>
	
		<input type="hidden"  name="task" value="posting_plan_checkout" />
		<input type="hidden"  name="view" value="japayment" />
		<?php }else {?>
		
		<input type="hidden"  name="task" value="posting_plan_checkout_by_credit" />
		<input type="hidden"  name="view" value="japayment" />
		<?php }?>
		<input type="hidden"  name="option" value="<?php echo $option;?>" />
		<input type="hidden"  name="layout" value="posting_plan_confirm" />	
		<input type="hidden"  name="Itemid" value="<?php echo JRequest::getInt('Itemid', 0);?>" />	
		
		<input type="hidden"  name="cid" value="<?php echo $this->item->id; ?>" />
		<input type="hidden"  name="ppid" value="2<?php echo $this->item->id; ?>" />
		<?php echo JHTML::_( 'form.token' ); ?>	
	</form>
				
</div>
</div>